import Queue


class AddOnEventID:
    EVENT_ON_INSTALL_FINISH = 1
    EVENT_ON_PACK_FINISH = 2


class AddOnEventQueue(object):

    __INST = None

    @staticmethod
    def inst():
        """
        not thread-safe
        """
        if AddOnEventQueue.__INST is None:
            AddOnEventQueue.__INST = AddOnEventQueue()
        return AddOnEventQueue.__INST

    def __init__(self):
        """
        not thread-safe
        """
        self.queue = Queue.Queue()

    def dispatch(self, eventid):
        """
        should not be called in main thread
        """
        self.queue.put(eventid)


__all__ = [
    "AddOnEventID",
    "AddOnEventQueue",
]
